package com.wh1200.xmlless.test.model

import com.wh1200.mybatis.xmlless.annotations.DeletedBy
import com.wh1200.mybatis.xmlless.annotations.DeletedDate
import com.wh1200.mybatis.xmlless.annotations.FeignProperty
import com.wh1200.mybatis.xmlless.annotations.JoinObject
import com.baomidou.mybatisplus.annotation.TableLogic
import jakarta.persistence.Id
import java.time.LocalDateTime

/**
 *
 * @author wuhao
 * @date 2024/1/25 10:58
 * @since v0.0.0
 * @version 1.0
 */

class JoinObjectEntity {

  @Id
  var id1: Int = 0
  var parentId: Int? = null

  @JoinObject(
      joinOnTargetProperty = "id2",
      joinOnThisProperty = "parentId",
      alias = "parentObj"
  )
  var parent: com.wh1200.xmlless.test.model.ParentJoinObjectEntity? = null

  @TableLogic
  var deleteFlag: Boolean = false

  @FeignProperty(
      targetEntity = com.wh1200.xmlless.test.model.ParentJoinObjectEntity::class,
      joinOnTargetProperty = "id2",
      alias = "p"
  )
  var pfield: String? = null

  @DeletedDate
  var deletedDate: LocalDateTime? = null

  @DeletedBy
  var deletedBy: String? = null

}

